#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
int main(){
    int a,b;
    scanf("%x %o",&a,&b);
    cout<<a+b<<endl;
    return 0;
}
